<template>
  <div class="br-layout-relative">
    <div class="br-layout-relative">
      <div class="br-layout-absolute br-border-bottom" style="top:0;height: 30px;line-height: 30px;">
        <span class="br-text" style="margin-left: 10px;" @click="$router.back(-1)"><i class="iconfont icon-fanhui"></i>&nbsp;&nbsp;<span>返回</span></span>
      </div>
      <div class="br-layout-absolute" style="top:40px;">
        <el-collapse v-model="activeNames">
          <el-collapse-item :title="item.title" :name="item.index" v-for="(item,a) in this.steps" :key="a">
            <template slot="title">
              <i class="el-icon-rank">&nbsp;{{item.title}}</i>
            </template>
            <div class="dragg-source" v-for="(child,b) in item.children" :key="b">
              <div class="dragg-img">
                <img :src="child.icon" :data-pluginId="child.pluginId" :alt="child.name" :title="child.description" />
              </div>
              <div class="dragg-name br-text-over" :title="child.name">{{child.name}}</div>
            </div>
          </el-collapse-item>
        </el-collapse>
      </div>
    </div>
  </div>
</template>

<script>
  import {
    getSteps
  } from '@/api/trans/trans'
  import {
    mapGetters
  } from 'vuex'
  export default {
    data() {
      return {
        searchTree: "",
        menuLoading: false,
        steps: [],
        activeNames: []
      }
    },
    props: {},
    computed: {
      ...mapGetters(['sidebar']),
      isHeight() {
        return this.sidebar.height;
      }
    },
    methods: {
      getSteps() {
        this.menuLoading = true
        getSteps().then((res) => {
          this.menuLoading = false
          if (res.data.status == 200) {
            this.steps = res.data.data;
            for (let i = 0; i < this.steps.length; i++) {
              this.activeNames.push(this.steps[i].index)
            }
          }
        })
      },
    },
    created() {
      this.getSteps();
    },
    mounted() {}

  };
</script>

<style lang="less" scoped>
  /deep/ .el-collapse-item__content {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .dragg-source {
    width: 60px;
    height: 80px;
    display: inline-block;
    margin: 5px 0 0 15px;
    text-align: center;
    cursor: pointer;
  }

  .dragg-source:hover {
    color: #3D6480;
  }

  .dragg-source .dragg-img {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    line-height: 40px;
    border: 1px solid #3D6480;
    border-radius: 4px;
    background-color: #FFFFFF;
  }

  .dragg-source .dragg-img img {
    width: 30px;
    height: 30px;
    vertical-align: middle;
  }

  .dragg-source .dragg-name {
    width: 100%;
    height: 40px;
    line-height: 40px;
    font-size: 12px;
  }
</style>
